<template>
  <div>
    扫码授权
  </div>
</template>

<script>

export default {
  data() {
    return {
      corpid: this.$route.params.corpid,
    }
  },
  created() {
    console.log(this.corpid)
    this.getAuthUrl()
  },
  methods: {
    getAuthUrl() {
      if (this.corpid == null || !this.corpid) {
        this.$router.push('/login?redirect=/dashboard')
        return
      }
      this.$api.permission.auth
        .getAuthUrl(this.corpid)
        .then(res => {
          window.location.href = res.data.auth_url
        })
        .catch(error => {
          console.log(error)
        })
    }
  }
}
</script>
